#include "File.hpp"
#include <stdexcept>

File::File(const std::string &filename) {
    file.open(filename);
    if (!file.is_open()) {
        throw std::runtime_error("Failed to open file");
    }
}

File::~File() {
    if (file.is_open()) {
        file.close();
    }
}

bool File::isOpen() const {
    return file.is_open();
}

bool File::readAll(std::string &content) {
    content.clear();
    std::string line;
    while (std::getline(file, line)) {
        content += line + "\n";
    }
    return true;
}
